<?php

/**
 * This is the model class for table "pasusiasuburumur".
 *
 * The followings are the available columns in table 'pasusiasuburumur':
 * @property integer $psubu_id
 * @property integer $psubu_kec
 * @property integer $psubu_20
 * @property integer $psubu_20_29
 * @property double $psubu_30_49
 * @property double $psubu_jumlah
 * @property integer $psubu_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $psubuKec
 */
class Pasusiasuburumur extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Pasusiasuburumur the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pasusiasuburumur';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('psubu_kec, psubu_20, psubu_20_29, psubu_tahun', 'numerical', 'integerOnly'=>true),
			array('psubu_30_49, psubu_jumlah', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('psubu_id, psubu_kec, psubu_20, psubu_20_29, psubu_30_49, psubu_jumlah, psubu_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'psubuKec' => array(self::BELONGS_TO, 'Kecamatan', 'psubu_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'psubu_id' => 'Psubu',
			'psubu_kec' => 'Psubu Kec',
			'psubu_20' => 'Psubu 20',
			'psubu_20_29' => 'Psubu 20 29',
			'psubu_30_49' => 'Psubu 30 49',
			'psubu_jumlah' => 'Psubu Jumlah',
			'psubu_tahun' => 'Psubu Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('psubu_id',$this->psubu_id);
		$criteria->compare('psubu_kec',$this->psubu_kec);
		$criteria->compare('psubu_20',$this->psubu_20);
		$criteria->compare('psubu_20_29',$this->psubu_20_29);
		$criteria->compare('psubu_30_49',$this->psubu_30_49);
		$criteria->compare('psubu_jumlah',$this->psubu_jumlah);
		$criteria->compare('psubu_tahun',$this->psubu_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}